<template>
  <el-container>
    <el-header>
      <ding-dong-header></ding-dong-header>
    </el-header>
    <el-main>
      <router-view />
      <ding-dong-current-play></ding-dong-current-play>
      <ding-dong-play-bar></ding-dong-play-bar>
      <ding-dong-scroll-top></ding-dong-scroll-top>
      <ding-dong-audio></ding-dong-audio>
    </el-main>
    <el-footer>
      <ding-dong-footer></ding-dong-footer>
    </el-footer>
  </el-container>
</template>

<script lang="ts" setup>
import { getCurrentInstance } from "vue";
import DingDongHeader from "@/components/layouts/DingDongHeader.vue";
import DingDongCurrentPlay from "@/components/layouts/DingDongCurrentPlay.vue";
import DingDongPlayBar from "@/components/layouts/DingDongPlayBar.vue";
import DingDongScrollTop from "@/components/layouts/DingDongScrollTop.vue";
import DingDongFooter from "@/components/layouts/DingDongFooter.vue";
import DingDongAudio from "@/components/layouts/DingDongAudio.vue";

const { proxy } = getCurrentInstance();

if (sessionStorage.getItem("dataStore")) {
  proxy.$store.replaceState(Object.assign({}, proxy.$store.state, JSON.parse(sessionStorage.getItem("dataStore"))));
}

window.addEventListener("beforeunload", () => {
  sessionStorage.setItem("dataStore", JSON.stringify(proxy.$store.state));
});
</script>

<style lang="scss" scoped>
@import "@/assets/css/var.scss";
@import "@/assets/css/global.scss";

.el-container {
  min-height: calc(100% - 60px);
}
.el-header {
  padding: 0;
}
.el-main {
  padding-left: 0;
  padding-right: 0;
}
</style>
